var OSS = require('ali-oss').Wrapper;

var client = new OSS({
  region: 'oss-cn-hangzhou',
  accessKeyId: 'LTAIOo424fxrbukr',
  accessKeySecret: 'KfxHOlKGPgz6ArESxk23SGqIx2Fuai',
  bucket: 'hk-cdn-static'
});

// client.put('object-key', './img/1.txt')
var fs = require('fs');
let files = []
function ScanDir(path) {
  let that = this
  if (fs.statSync(path).isFile()) {
    return files.push(path)
  }
  try {
    fs.readdirSync(path).forEach(function (file) {
      ScanDir.call(that, path + '/' + file)
    })
  } catch (e) {
  }
}

ScanDir('./project/')
var res = []
files.forEach(function(val,index){
    res.push(val.replace('//','/'))
})
res.forEach(function(val){
  // console.log(val);
  client.put('activity'+val.replace('./','/'), val)
})